<?php
require_once('../../common/_init.php');
require_once('../../common/_function.php');
require_once(CLASS_PATH.GENERAL_PATH."/__autoload.php");

$con     = objectFactory::create('P79DAO');


$qry = 'PREPARE statement FROM "SELECT lp.pSerial, lp.pType, lp.pMaker, lp.pName, lp.pComment FROM list_printer AS lp, haystack_printer AS hp WHERE (hp.ppDigit LIKE ?) AND (hp.ppString LIKE ?) AND (lp.pSerial = hp.pSerial) ORDER BY lp.pMaker, lp.pName" ';

$con->db_query($qry);


$qry = 'SET @1 = "%200%", @2 = "%dt%"';

$con->db_query($qry);

$qry = 'EXECUTE statement USING @1, @2';

$result = $con->db_query($qry);

$con->db_query('DEALLOCATE PREPARE statement');   // 메모리 비우기

// if($result) echo mysqli_num_rows($result);


$data = null;
	  $pMkr = $k = $data = null;     // 변수 선언 및 초기화

      while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
	  {
	   
	     if($pMkr != $row['pMaker'])
		 {
		    $k    .= "<h4>".$row['pMaker']."</h4>";
		    $pMkr =  $row['pMaker'];
		 }	  
		 
         $k .= "<li>".$row['pSerial']." - ".$row['pName'];
		 
		 $comment =  $row['pComment'];
		 if(isset($comment))
		 {
		    $k .= "<br />".$comment;
		 }
		  $k .= "</li>";  
		  
	  }
	  
	  if(!empty($k))
	  {
	     $data .= "<ul>".$k."</ul>";
	  }
	  
	  echo $data;



?>